//
//  Root_MineViewController.m
//  QMCXDriver
//
//  Created by Massimo on 2017/4/12.
//  Copyright © 2017年 Massimo. All rights reserved.
//

#import "Root_MineViewController.h"
#import "QSliderButton.h"
#import "LoginViewController.h"

@interface QMineTableViewCell : UITableViewCell
@property (nonatomic, weak) IBOutlet UILabel *myTitleLabel;
@property (nonatomic, weak) IBOutlet UIImageView *icon; 
@end


@interface Root_MineViewController ()
//@property (nonatomic, weak)IBOutlet QSliderButton *sliderButton;
@property (nonatomic, strong)NSArray *titles;
@property (nonatomic, strong)NSArray *imageNames;
@property (nonatomic, strong)NSArray *nextViewControllerNames;
@end

@implementation Root_MineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    [self.sliderButton addTargetForSlide:self action:@selector(slide:)];
    
    _titles                     = @[@"使用指南",
                                    @"关于我们",
                                    @"设置"];
    _imageNames                 = @[@"icon_Mine_useGuide",
                                    @"icon_Mine_AboutUs",
                                    @"icon_Mine_settings"];
    _nextViewControllerNames  = @[@"QUseGuideVC",
                                    @"QAboutUsVC",
                                    @"QSettingsVC"];
}

- (void)slide:(QSliderButton*)sender{
    NSLog(@"slide finish");
}
- (void)loadData{
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    QMineTableViewCell *cell  = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.myTitleLabel.text = _titles[indexPath.row];
    cell.icon.image = [UIImage imageNamed:_imageNames[indexPath.row]];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UIViewController *viewController = [[UIStoryboard storyboardWithName:@"Mine" bundle:nil] instantiateViewControllerWithIdentifier:_nextViewControllerNames[indexPath.row]];
    [self.navigationController pushViewController:viewController animated:YES];
    
}


- (IBAction)tapUserInfo:(UITapGestureRecognizer*)tap{
    
    if (1) {
        UIViewController *viewController = [[UIStoryboard storyboardWithName:@"Mine" bundle:nil] instantiateViewControllerWithIdentifier:@"QUserInfoVC"];
        [self.navigationController pushViewController:viewController animated:YES];
        return;
    }
    
    LoginViewController *vc = (LoginViewController *) LLStoryboard(@"Main",@"LoginVC");
    [vc setLoginSuccess:^(id userInfo) {
        
    }];
    [self.navigationController presentViewController:vc animated:YES completion:nil];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


@implementation QMineTableViewCell

- (void)awakeFromNib{
    [super awakeFromNib];
}

@end

